import junit.framework.TestCase;


public class LiczbaTest extends TestCase {

	Liczba a = null;
	Liczba b = null;
	
	protected void setUp() throws Exception {
		super.setUp();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
		
		a = null;
		b = null;
		
	}

	public void testLiczbaInt() {
		try
		{
			a = new Liczba(-2);
			fail("Wyjatek niewyrzucony");
		}
		catch (LiczbaException success){}
		catch (Exception ex){fail("Nieoczekiwany wyjatek");}
		
		try
		{			
			b = new Liczba(8);
			assertNotNull("Failure",b);
			a = new Liczba(8);
			assertNotSame(a,b);
		}
		catch (Exception ex){fail("Nieoczekiwany wyjatek");}
		
	}

	public void testZapis() {
		try
		{
			
			a = new Liczba(8);
			assertEquals("Failure","1000",a.zapis(2));
			b = new Liczba(10);
			assertTrue("Failure","A".compareTo(b.zapis(16))==0);
			
		}
		catch (Exception ex)
		{
			fail("Zly wyjatek");
		}
	}

}






